﻿@using PayrollExpress.Helpers;
@using PayrollExpress.Models;
@model HolidayListModel

@Html.Partial("_BreadCrumb", Model.BreadCrumb)

<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <div class="row">
                        <div class="col-lg-3">
                            @Html.DropDownListFor(m => m.SelectedYear, Model.Years, new { @class = "form-control input", @onchange = "Refresh()" })
                            <button id="btnSearch" type="submit" class="hidden" name="command" value="Refresh"></button>
                        </div>
                        <div class="col-lg-9">
                            @Html.ActionLink(BaseHelper.PageAction.Add.ToString(), BaseHelper.PageAddEditSave.HolidaysAdd.ToString(), Model.ControllerName, null, new { @class = "btn btn-primary" })
                        </div>
                    </div>
                </div>
                <div class="ibox-content">
                    <table class="table table-striped table-bordered table-hover table-List">
                        <thead class="header">
                            <tr>
                                <th>@MasterfileHelper.ListHeaders.Date.ToDescription()</th>
                                <th>@MasterfileHelper.ListHeaders.Description.ToDescription()</th>
                                <th>@MasterfileHelper.ListHeaders.HolidayTypeName.ToDescription()</th>
                                <th></th>
                            </tr>
                        </thead>
                        <tbody>
                            @for (var i = 0; i < Model.ListItems.Count(); i++)
                            {
                                <tr>
                                    <td>
                                        @(((AdministrationHelper.CalendarMonth)Model.ListItems[i].Month).ToDescription())
                                        @Html.ValueFor(m => m.ListItems[i].Day, "{0:00}"),
                                        @Html.DisplayFor(m => m.ListItems[i].Year)
                                    </td>
                                    <td>@Html.DisplayFor(m => Model.ListItems[i].Description)</td>
                                    <td>
                                        @Html.DisplayFor(m => Model.ListItems[i].HolidayTypeName)
                                        @Html.HiddenFor(m => Model.ListItems[i].RecurringHolidayID)
                                    </td>
                                    <td>@Html.ActionLink(BaseHelper.PageAction.Edit.ToDescription(), BaseHelper.PageAddEditSave.HolidayEdit.ToString(), Model.ControllerName, null, null, null, new { id = Model.ListItems[i].ID }, new { @class = "btn btn-primary btn-sm" })</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

@section Styles {
    @Styles.Render("~/Content/plugins/dataTables/dataTablesStyles")
}

@section Scripts {
    @Scripts.Render("~/plugins/dataTables")

    <script type="text/javascript">
        $(document).ready(function () {
            $('.table-List').dataTable();
        });
    </script>
}